package com.upf1sh.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.upf1sh.bean.User;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface UserMapper extends BaseMapper<User> {
    @Select("select * from t_user where username=#{username}")
    User findByUN(String username);

    /**
     * 更新在线状态
     *
     * @param change
     * @param username
     * @return
     */
    @Update("update t_user set isonline=#{change} where username=#{username}")
    int changeIsOnline(String change, String username);

    /**
     * 更新ip地址
     * 2023/4/27 20:54
     * UpF1sh
     *
     * @param ip
     * @param username
     * @return
     */

    @Update("update t_user set ip=#{ip} where username=#{username}")
    int changeIp(String ip, String username);

    @Update("update t_user set isonline=#{quit} where username=#{username}")
    int quitUser(String quit, String username);

    /**
     * 修改密码
     * 2023/4/28 21:07
     * UpF1sh
     *
     * @param username
     * @param password
     * @return
     */
    @Update("update t_user set password=#{password} where username=#{username}")
    int resetPassword(String username, String password);


}
